<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>登录</title>

    <link th:href="@{{su}/common/css/bootstrap.min.css(su=${staticUrl})}" rel="stylesheet">
    <link th:href="@{{su}/common/font-awesome/css/font-awesome.css(su=${staticUrl})}" rel="stylesheet">

    <link th:href="@{{su}/common/css/animate.css(su=${staticUrl})}" rel="stylesheet">
    <link th:href="@{{su}/common/css/style.css(su=${staticUrl})}" rel="stylesheet">
    <!-- Sweet Alert -->
    <link th:href="@{{su}/common/css/plugins/sweetalert/sweetalert.css(su=${staticUrl})}" rel="stylesheet">
</head>

<body class="gray-bg">

<div class="loginColumns animated fadeInDown">
    <div class="row">

        <div class="col-md-6">
            <h2 class="font-bold">项目管理系统</h2>

            <p>
                加油！加油！加油！加油！加油！加油！
            </p>

            <p>
                美女是你的。
            </p>

            <p>
                加油！加油！加油！加油！加油！加油！
            </p>

            <p>
                钞票是你的。
            </p>

            <p>
                加油！加油！加油！加油！加油！加油！
            </p>

            <p>
                房子是你的。
            </p>

            <p>
                加油！加油！加油！加油！加油！加油！
            </p>

            <p>
                车子是你的。
            </p>

        </div>
        <div class="col-md-6">
            <div class="ibox-content">
                <form class="m-t" role="form" th:action="@{{su}/user/ajax/login(su=${staticUrl})}"
                      th:list-url="@{{su}/project/list(su=${staticUrl})}" id="loginForm">
                    <input type="hidden" name="password" id="pwd">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="账号" name="loginName" id="loginName"
                               required="" autocomplete="off">
                    </div>
                    <div class="form-group">
                        <input type="password" class="form-control" placeholder="密码" id="password" required="">
                    </div>
                    <button type="button" class="btn btn-primary block full-width m-b" onclick="login()">登录</button>

                    <a href="#">
                        <small>忘记密码了？</small>
                    </a>

                    <p class="text-muted text-center">
                        <small>没有帐户？</small>
                    </p>
                    <a class="btn btn-sm btn-white btn-block" href="#">创建帐户</a>
                </form>
                <p class="m-t">
                    <small>Inspinia we app framework base on Bootstrap 3 &copy; 2014</small>
                </p>
            </div>
        </div>
    </div>
    <hr/>
    <div class="row">
        <div class="col-md-6">
            Copyright Example Company
        </div>
        <div class="col-md-6 text-right">
            <small>© 2014-2015</small>
        </div>
    </div>
</div>

<script th:src="@{{su}/common/js/jquery-3.1.1.min.js(su=${staticUrl})}"></script>
<script th:src="@{{su}/common/js/jquery.form.js(su=${staticUrl})}"></script>
<script th:src="@{{su}/common/js/md5.js(su=${staticUrl})}"></script>
<script th:src="@{{su}/qmy/js/common.js(su=${staticUrl})}"></script>
<!-- Sweet alert -->
<script th:src="@{{su}/common/js/plugins/sweetalert/sweetalert.min.js(su=${staticUrl})}"></script>
<script>
    //保存数据
    function login() {
        var loginName = $("#loginName").val();
        if (loginName == '') {
            msgAlert("未输入账号");
            return;
        }
        var password = $("#password").val();
        if (password == '') {
            msgAlert("未输入密码");
            return;
        }
        $("#pwd").val(hex_md5(password))
        //定义参数
        var options = {
            url: $("#loginForm").attr("action"),
            dataType: "json",
            type: "post",
            success: function (re) {
                if (re.status) {
                    // layer.msg(re.msg)
                    location.href = $("#loginForm").attr("list-url");
                } else {
                    msgAlert("账号或密码错误");
                }
            },
            error: function () {
                msgAlert("操作失败");
            }
        };
        //jquery.form使用方式
        $("#loginForm").ajaxSubmit(options);
    }
</script>
</body>

</html>
